package com.cdp.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cdp.common.core.domain.entity.PlatformVisit;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface PlatformVisitMapper extends BaseMapper<PlatformVisit> {
    /**
     * 查询最近 1 小时的访问量
     * @return 最近 1 小时的访问记录数
     */
    @Select("SELECT COUNT(*) FROM sys_platform_visits WHERE visit_timestamp > NOW() - INTERVAL 1 HOUR")
    int getRealTimeVisitCount();
}
